home *** CD-ROM | disk | FTP | other *** search
/ PC-X 1997 October / pcx14_9710.iso / swag / math.swg / 0123_Calculating Interest Rates?.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1997-05-30  |  496 b   |  18 lines

  1.  
  2. I use the following function to calculate present value:
  3.  
  4. function PresentValue(FV, IR, PMT : Real; N : Integer) : Real;
  5. var
  6.    IFactor, IFactor1, R1, R2 : Real;
  7. begin
  8.      {set values of variables}
  9.      IFactor      := (IR / 1200.0);
  10.      IFactor1     := (1.0 + IFactor);
  11.      R1           := Exp(-N * LN(IFactor1));
  12.      R2           := ((FV * IFactor) - (-PMT)) + ((Exp(N * LN(IFactor1))) * (-PMT));
  13.      {calc the result}
  14.      PresentValue := ((R1 * R2) / IFactor);
  15. end;
  16.  
  17.  
  18.